<?php

namespace App\Http\Requests\Project;

use Illuminate\Foundation\Http\FormRequest;

class PmProjectReportRequest extends FormRequest
{
    /**
     * 表示验证器是否应在第一个规则失败时停止
     *
     * @var bool
     */
    protected $stopOnFirstFailure = true;

    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
     */
    public function rules(): array
    {
        return [
            'report_type' => 'required',
            'execute_period' => 'required',
            'previous_summary' => 'required',
            'future_plan' => 'required',
            'project_id' => 'required',
        ];
    }

    /**
     * 获取已定义验证规则的错误消息
     *
     * @return string[]
     */
    public function messages()
    {
        return [
            'report_type.required' => '报告类型不能为空',
            'execute_period.required' => '执行周期不能为空',
            'previous_summary.required' => '工作进展不能为空',
            'future_plan.required' => '工作计划不能为空',
            'project_id.required' => '报告所属项目不能为空',
        ];
    }
}
